home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / yacc.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  1.8 KB  |  61 lines

  1. " Vim syntax file
  2. " Language:    Yacc
  3. " Maintainer:  Dr. Charles E. Campbell, Jr. <Charles.Campbell@gsfc.nasa.gov>
  4. " Last change:    June 22, 1998
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " Read the C syntax to start with
  10. source <sfile>:p:h/c.vim
  11.  
  12. " Yacc stuff
  13. syn match    yaccDelim    "^[ \t]*[:|;]"
  14. syn match    yaccOper    "@\d\+"
  15.  
  16. syn match    yaccKey    "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
  17. syn match    yaccKey    "[ \t]%\(prec\|expect\|nonassoc\)\>"
  18. syn match    yaccKey    "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
  19. syn keyword    yaccKeyActn    yyerrok yyclearin
  20.  
  21. syn region    yaccUnion    matchgroup=yaccKey start="%union[\$ \t]*{\=" matchgroup=yaccBrace end="}"    contains=yaccKey,cComment,yaccBrace,cType,cStructure,cStorageClass
  22. syn match    yaccBrkt    contained "[<>]"
  23. syn match    yaccType    "<[a-zA-Z_][a-zA-Z0-9_]*>"    contains=yaccBrkt
  24. syn match    yaccDefinition    "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
  25.  
  26. " special Yacc separators
  27. syn match    yaccSep    "^[ \t]*%%"
  28. syn match    yaccSep    "^[ \t]*%{"
  29. syn match    yaccSep    "^[ \t]*%}"
  30.  
  31. " I'd really like to highlight just the outer {}.  Any suggestions???
  32. syn match    yaccBraceError    "[{}]"
  33. syn region    yaccAction    matchgroup=yaccBrace start="{" end="}" contains=ALLBUT,yaccDelim,cInParen,cTodo,cIncluded,yaccDelim,yaccBraceError
  34.  
  35. if !exists("did_yacc_syntax_inits")
  36.   " The default methods for highlighting.  Can be overridden later
  37.   let did_yacc_syntax_inits = 1
  38.  
  39.   " Internal yacc highlighting links
  40.   hi link yaccBrace    yaccDelim
  41.   hi link yaccBrkt    yaccStmt
  42.   hi link yaccKey    yaccStmt
  43.   hi link yaccOper    yaccStmt
  44.  
  45.   " External yacc highlighting links
  46.   hi link yaccStmt    Statement
  47.   hi link yaccDefinition    Function
  48.   hi link yaccDelim    Function
  49.   hi link yaccKeyActn    Special
  50.   hi link yaccSep    Delimiter
  51.   hi link yaccType    Type
  52.   hi link yaccBraceError    Error
  53.  
  54.   " since Bram doesn't like my Delimiter :|
  55.   hi link Delimiter    Type
  56. endif
  57.  
  58. let b:current_syntax = "yacc"
  59.  
  60. " vim: ts=15
  61.